package cn.kimming.wms.query;

import cn.kimming.wms.util.StringUtils;
import lombok.Getter;
import lombok.Setter;

public class ProductQueryObject extends QueryObject{
	@Getter @Setter
	private String keyword;	//关键词(货品名称或编码)
	@Getter @Setter
	private Long brandId = -1L;

	@Override
	protected void customizedQuery() {
		if (StringUtils.isNotEmpty(keyword)) {
			addCondition("(obj.name like ? OR obj.sn like ?)", "%"+keyword+"%","%"+keyword+"%");
		}
		if (brandId > 0) {
			addCondition("obj.brand.id = ?", brandId);
		}
	}
}
